<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.baoku.wap.dao.*"  %>
<%@ page import="com.baoku.wap.entity.*" %>
<%@ page import="com.baoku.wap.util.*" %>
<%@ include file="session.jsp" %>
<%
	int knowledgeid = 0;
	
	try{
	    knowledgeid = Integer.parseInt(request.getParameter("knowledgeid"));
	}catch(Exception e){
		String ref = request.getHeader("REFERER");
		response.sendRedirect(ref);
		return;
	}//数据判断
		
	if (login){
		String content = request.getParameter("content");
		if (content == null || content == ""){
			String ref = request.getHeader("REFERER");
			response.sendRedirect(ref);
			return;
		} else {
			content = new GetUtf().getString(content);
		
		}//数据判断
		
		String userid = (String)session.getAttribute("id");
		
		Commont commont = new Commont();
		commont.setCom(content);
		commont.setKnowledgeid(knowledgeid);
		commont.setUserid(userid);
		new UserFactory().saveCom(commont);
		
		String ref = request.getHeader("REFERER");
		response.sendRedirect(ref);
	}else{
		response.sendRedirect("docom_err.jsp?id="+knowledgeid);
	}
	
%>
